package Code;

//需求：把一个数组中国的元素复制到另一个数组
public class Test4 {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5,6};

        int[] newArr = Copy(arr);

        for (int i = 0; i < newArr.length; i++) {
            System.out.println(newArr[i]);
        }

    }
    public static int[] Copy(int[] arr){
        int[] newArr = new int[arr.length];

        for (int i = 0; i < arr.length; i++) {
            newArr[i] = arr[i];
        }

        return newArr;
    }
}
